<!doctype html>
<!--
@license
Copyright (c) 2018 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<html>

<head>
  <title>URL Polyfill</title>
  <script>window.URL = null</script>
  <script id="loader" src="../webcomponents-loader.js"></script>
  <script src="./wct-config.js"></script>
  <script src="../node_modules/wct-browser-legacy/browser.js"></script>
</head>
<body>
  <script>
    suite('URL', function() {
      test('URL exits on window', function() {
        assert(window.URL);
      });
      test('URL constructor works', function() {
        assert.doesNotThrow(() => new URL('http://foo.com'));
      });
      test('URL does resolution correctly', function () {
        const loader = document.querySelector('script#loader');
        const u = new URL('../webcomponents-loader.js', location.href);
        assert.equal(loader.src, u.href);
      });
      test('URL has hash', function() {
        const u = new URL('#hash', document.baseURI);
        assert.equal(u.hash, '#hash');
      });

      test('URL has search', function() {
        const u = new URL('?search', document.baseURI);
        assert.equal(u.search, '?search');
      });
    });
  </script>
</body>
</html>
